net.minecraft.src.customstuff.scripts
Class Crafting

java.lang.Object
  extended by net.minecraft.src.customstuff.scripts.Crafting

public class Crafting
extends java.lang.Object


Constructor Summary
Crafting(net.minecraft.src.IInventory crafting, net.minecraft.src.EntityPlayer player)
           
 
Method Summary
 void addToInventory(int id, int count, int damage)
          Adds items to the crafting inventory, if there is space for them.
 void addToInventorySlot(int slotId, int count)
          Adds items to a slot if there is a item in it
 void clearInventory()
          Clears the crafting inventory
 void clearInventorySlot(int slotId)
          Clears a slot of the crafting inventory
 void damageItem(int slotId, int damage)
          Damages a item in a slot
 void fillInventory(int id, int damage)
          Fills up the crafting inventory.
 void fillInventorySlot(int slotId)
          Fills up a slot of the crafting inventory if there is a item in it
 int getItemCount(int id, int damage)
           
 int getItemDamage(int slotId)
           
 int getItemId(int slotId)
           
 int getItemStackSize(int slotId)
           
 int getMaxItemDamage(int slotId)
           
 int getSize()
           
 int getSlot(int id)
           
 int getSlot(int id, int damage)
           
 void removeFromInventory(int id, int count, int damage)
          Removes items from the crafting inventory
 void removeFromInventorySlot(int slotId, int count)
          Removes item from a slot if there is a item in it
 void setInventorySlot(int slotId, int id, int count, int damage)
          Sets the item in the slot of the crafting inventory
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Crafting

public Crafting(net.minecraft.src.IInventory crafting,
                net.minecraft.src.EntityPlayer player)
Method Detail

getSize

public int getSize()
Returns:
returns the size of the crafting inventory

getSlot

public int getSlot(int id)
Parameters:
id - The ID of the item that is searched
Returns:
The slotID of the searched item or -1 if it was not found

getSlot

public int getSlot(int id,
                   int damage)
Parameters:
id - The ID of the item that is searched
damage - The damage of the item that is searched
Returns:
The slotID of the searched item or -1 if it was not found

clearInventory

public void clearInventory()
Clears the crafting inventory


fillInventory

public void fillInventory(int id,
                          int damage)
Fills up the crafting inventory. It doesn't replace other items, but fills up stacks of the same item

Parameters:
id - The ID of the item
damage - The damage of the item

addToInventory

public void addToInventory(int id,
                           int count,
                           int damage)
Adds items to the crafting inventory, if there is space for them. It also adds items to existing stacks of the same item

Parameters:
id - The ID of the item
count - The amount to add
damage - The damage of the item

removeFromInventory

public void removeFromInventory(int id,
                                int count,
                                int damage)
Removes items from the crafting inventory

Parameters:
id - The ID of the item
count - The amount to remove
damage - The damage of the item

clearInventorySlot

public void clearInventorySlot(int slotId)
Clears a slot of the crafting inventory

Parameters:
slotId - The ID of the slot to clear

fillInventorySlot

public void fillInventorySlot(int slotId)
Fills up a slot of the crafting inventory if there is a item in it

Parameters:
slotId - The ID of the slot to fill

setInventorySlot

public void setInventorySlot(int slotId,
                             int id,
                             int count,
                             int damage)
Sets the item in the slot of the crafting inventory

Parameters:
slotId - The ID of the slot to set
id - The ID of the item
count - The stacksize of the item
damage - The damage of the item

removeFromInventorySlot

public void removeFromInventorySlot(int slotId,
                                    int count)
Removes item from a slot if there is a item in it

Parameters:
slotId - The ID of the slot to remove the item
count - The amount of items to remove

addToInventorySlot

public void addToInventorySlot(int slotId,
                               int count)
Adds items to a slot if there is a item in it

Parameters:
slotId - The ID of the slot
count - The amount of items to add

damageItem

public void damageItem(int slotId,
                       int damage)
Damages a item in a slot

Parameters:
slotId - The ID of the slot
damage - The damage to add to the item

getItemId

public int getItemId(int slotId)
Parameters:
slotId - The ID of the slot
Returns:
The id of the item in the slot or -1 if the slot is empty

getItemStackSize

public int getItemStackSize(int slotId)
Parameters:
slotId - The ID of the slot
Returns:
The stacksize of the item in the slot or -1 if the slot is empty

getItemDamage

public int getItemDamage(int slotId)
Parameters:
slotId - The ID of the slot
Returns:
The damage of the item in the slot or -1 if the slot is empty

getMaxItemDamage

public int getMaxItemDamage(int slotId)
Parameters:
slotId - The ID of the slot
Returns:
The maximum damage of the item or -1 if the slot is empty

getItemCount

public int getItemCount(int id,
                        int damage)
Parameters:
id - The ID of the item
damage - The damage of the item
Returns:
The count of items in the crafting inventory